package com.nbsaas.boot.merchant.rest.resource;

import com.nbsaas.boot.merchant.api.apis.MerchantReviewApi;
import com.nbsaas.boot.merchant.data.entity.MerchantReview;
import com.nbsaas.boot.merchant.api.domain.request.MerchantReviewRequest;
import com.nbsaas.boot.merchant.api.domain.response.MerchantReviewResponse;
import com.nbsaas.boot.merchant.api.domain.simple.MerchantReviewSimple;
import com.nbsaas.boot.merchant.rest.convert.MerchantReviewSimpleConvert;
import com.nbsaas.boot.merchant.rest.convert.MerchantReviewEntityConvert;
import com.nbsaas.boot.merchant.rest.convert.MerchantReviewResponseConvert;
import com.nbsaas.boot.merchant.data.repository.MerchantReviewRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商家评价-业务接口实现
*/
@Transactional
@Service
public class MerchantReviewResource extends BaseResource<MerchantReview,MerchantReviewResponse, MerchantReviewSimple, MerchantReviewRequest>  implements MerchantReviewApi {

    @Resource
    private MerchantReviewRepository merchantReviewRepository;

    @Override
    public JpaRepositoryImplementation<MerchantReview, Serializable> getJpaRepository() {
        return merchantReviewRepository;
    }

    @Override
    public Function<MerchantReview, MerchantReviewSimple> getConvertSimple() {
        return new MerchantReviewSimpleConvert();
    }

    @Override
    public Function<MerchantReviewRequest, MerchantReview> getConvertForm() {
        return new MerchantReviewEntityConvert();
    }

    @Override
    public Function<MerchantReview, MerchantReviewResponse> getConvertResponse() {
        return new MerchantReviewResponseConvert();
    }




}


